const INIT_STATE={
        renderList: [],
        inputValue: '',
        list:[],
        allIndex:0
}
export const todoListReducer=(state = INIT_STATE,action={})=>{
        const { type, payload = {} } = action;
        const { dataSource = [] ,eventTarget,renderList,inputValue} = payload;
        switch(type){
                case "inputChange":
                        return {
                                ...state,
                                inputValue: eventTarget
                        }
                case"enter":
                return{
                        ...state,  
                        renderList,
                        inputValue
                }
                case"click":
                return{
                        ...state,  
                        renderList
                }
                default :   return state
        }
     
}

export default todoListReducer